<template>
	<view class="page">
		<view class="infoBox">
			<view class="row">
				<view class="lable">
					{{language.phoneFace.label1}}:
				</view>
				<view class="value">
					{{selectInfoAccount.name | emptyStr}}
				</view>
			</view>
			<view class="row">
				<view class="lable">
					{{language.phoneFace.label2}}:
				</view>
				<view class="value">
					{{selectInfoAccount.code | emptyStr}}
				</view>
			</view>
			<view class="row">
				<view class="lable">
					{{language.phoneFace.label3 }}:
				</view>
				<view class="value">
					{{selectInfoAccount.departName ? selectInfoAccount.departName : language.phoneFace.label7}}
				</view>
			</view>
			<view class="row">
				<view class="lable">
					{{language.phoneFace.label6}}:
				</view>
			</view>
			<!-- <view class="row">
				<view class="lable">
					注册状态:
				</view>
				<view class="value">
					{{ selectInfoAccount.photo ? '已注册' : '未注册'}}
				</view>
			</view> -->
		</view>
		
		<image class="image" :src="imgBaseUrl3+selectInfoAccount.photo" v-if="selectInfoAccount.photo" mode="aspectFit"></image>
		<image class="image" :src="imgBaseUrl+'/images/default_avatar.png'" v-else mode="aspectFit"></image>
		<view class="btn" @click="takeImage">
			{{language.phoneFace.btn1}}
		</view>
		<view class="tipText">
			<u-icon name="info-circle-fill" color="#169bd5" size="26" ></u-icon>
			<text style="margin-left:10rpx;">
			{{language.phoneFace.tip6}}
			</text>
		</view>
		
		<view class="tips" style="background-color: #f0f0f0;margin-top: 30rpx;padding-bottom: 20rpx;border-radius: 30rpx;margin-bottom: 40rpx;width: 690rpx;">
		  <view  class="bottomview">
		    <text>{{language.phoneFace.tip1}}： 
		    </text>
		  </view>
		  <view  class="bottomview">
		    <text style="text-indent: 2em">{{language.phoneFace.tip2}}
		    </text>
		  </view>
		  <view  class="bottomview">
		    <text style="text-indent: 2em">{{language.phoneFace.tip3}}
		    </text>
		  </view>
		  <view  class="bottomview">
		    <text style="text-indent: 2em">{{language.phoneFace.tip4}}
		    </text>
		  </view>
		  <view  class="bottomview">
		    <text style="text-indent: 2em">{{language.phoneFace.tip5}}
		    </text>
		  </view>
		</view>
	</view>
</template>

<script>
	import {getPersonApi,getoaOpenInfoApi} from '@/common/api/commonApi/commonApi.js'
	export default {
		data() {
			return {
				image : '',
				count : 0,
				isRegister : false,
				form: {
					memberName : '',
					memberNo : '',
					subsidiaryName : ''
				},
				selectInfoAccount: uni.getStorageSync('selectInfoAccount')
			}
		},
		methods: {
			takeImage(){
				this.count = 0
				this.goPage('/pages/componentsB/faceEntry/faceEntry')
			},
			postInfo(){
				let formData = {
					personId : this.selectInfoAccount.id
				} 
				this.uploadFile('/baseinfo/ssPerson/appUploadImag',this.image,formData,'file').then(res=>{
					let data = JSON.parse(res.data)
					console.log(data);
					if(data.code == '00'){
						this.setMessage('上传成功')
						this.getImageInfo()
					}else{
						this.setMessage('上传失败，请重新拍照上传！')
					}
					console.log(data);
				})
			},
			getRemberInfo(){
					let selectInfoAccount = uni.getStorageSync('selectInfoAccount')
					return getPersonApi({
						personId : selectInfoAccount.id ? selectInfoAccount.id : ''
					}).then(res=>{
						console.log(res);
						this.selectInfoAccount = res.result.personList[0]
						uni.setStorageSync('selectInfoAccount',this.selectInfoAccount)
					}).catch(err=>{
						console.log(err);
						// if(err.code==500 && err.message == '该微信没有绑定'){
						// 	this.bindAccount()
						// }
					})
				
				
			},
			// getImageInfo(){
			// 	getfeatureImgApi().then(res=>{
			// 		if(res.imagebase64){
			// 			this.image = res.imagebase64.replace(/[\r\n]/g,"")
			// 			this.isRegister = true
			// 			console.log(this.image);
			// 		}
			// 	})
			// }
		},
		onLoad() {
			// this.getImageInfo()
		},
		onShow() {
			this.getRemberInfo()
			// uni.$on('validimgEmit',(res)=>{
			// 	if(this.count > 0) return
			// 	this.count++
			// 	this.image = res.image
			// 	this.postInfo()
			// })
		},
	}
</script>

<style lang="scss" scoped>
	.tipText{
		display: flex;
		align-items: center;
		margin-top: 20rpx;
		padding-left: 30rpx;
	}
.page{
	background-color: #fff;
	height: 100vh;
	.infoBox{
		height: 380rpx;
		padding: 100rpx 70rpx 0;
		.row{
			&:nth-child(1){
				font-size: 34rpx;
				color: #000;
			}
			display: flex;
			justify-content: space-between;
			margin-bottom: 40rpx;
			.label{
				
			}
			.value{
				
			}
		}
	}
	.image{
		width: 420rpx;
		height: 420rpx;
		margin: 50rpx auto;
		// background-color: #4089f0;
	}
	.btn{
		color: #fff;
		background-color: #4089f0;
		width: 310rpx;
		height: 90rpx;
		margin: auto;
		border-radius: 10rpx;
		@include flexCenter;
	}
	.tips{
		margin:20rpx  auto;
		margin-bottom: 50rpx;
		// @include flexCenter;
	}
}

.bottomview{
  display: flex;
  font-size: 16px;
  font-family: sans-serif;
  color: #5a5745;
  margin-top: 10rpx;
  box-sizing: border-box;
  padding: 0 30rpx;
}
</style>
